package com.micro.repository;

import com.micro.entity.Message;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface MessageRepository extends BaseMapper<Message> {
    // 按照OrderId降序排序查询
    List<Message> findByUserIdOrderByMessageIdDesc(@Param("userId") Long userId);

    //根据用户id和type找对应的消息列表
    List<Message> findByUserIdAndMessageTypeOrderByCreateTimeDesc(@Param("userId") Long userId, @Param("messageType") Integer messageType);

}
